package com.xbwang.contant;

import lombok.Data;

/**
 * 通用返回值
 */
@Data
public class Ret<T> {
    private Integer code;
    private Object data;
    private String msg;

    public Ret<T> setFail(String msg){
        Ret<T> ret = new Ret<>();
        ret.setCode(500);
        ret.setMsg(msg);
        return ret;
    }
    public Ret<T> setSuccess(Object data){
        Ret<T> ret = new Ret<>();
        ret.setCode(200);
        ret.setData(data);
        return ret;
    }
    public Ret<T> setSuccess(Object data,String msg){
        Ret<T> ret = new Ret<>();
        ret.setCode(200);
        ret.setData(data);
        ret.setMsg(msg);
        return ret;
    }
}
